import { request } from '../../../utils/requestUtils';
Page({
  /**
   * 组件的初始数据
   */
  data: {
    itemList: [],//商品列表
    typeShow: false,
    form: {
      unitName: '',// 类别名称
      unitDesc: '',// 类别描述
      stallId: '',// 摊位id
    },
    total: 0,
    page: {
      pageNum: 1,
      pageSize: 100,
    },
    params: {
      keywords: ''//查询关键字
    },
    current: 0,
    topHeight: 44,
    viewHeight: 640,
    dataList: []
  },

  onLoad(options) {
    this.getDiscount();
  },
  /**
   * 组件的方法列表
   */


  // 使用优惠卷
  exchangeCoupon(e) {
    console.log('sss')
    wx.switchTab({
      url: '/pages/customer_index/index',
    })
  
  },

  async getDiscount() {
    const result = await request({
      url: `/bus/cust/customer/list?pageNum=1&pageSize=50`,
      method: "post",
      data: {
        params: {}
      }
    });
    if (result.data.code == 200) {
      this.setData({
        itemList: result.data.rows,
        total: result.data.total
      })

    }
  }

})